﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>南京化工职业技术学院资源共享平台--用户注册</title>
		<link href="<%=basePath%>res/css/css.css" type="text/css"
			rel="stylesheet" />
		<script type="text/javascript"
			src="<%=basePath%>res/js/jquery-1.2.6.js"></script>
		<script type="text/javascript">
			function check() {
				var loginName = $("#loginName").val();
				if(loginName == null || $.trim(loginName) == "") {
					alert("请填写用户名！");
					return false;
				}
				//判断用户输入昵称的长度
				if(loginName.length < 6) {
					alert("用户名长度不可少于6位！");
					return false;
				}
				
				if(loginName.length > 16) {
					alert("用户名长度不可超过16位！");
					return false;
				}
				if(!/^[a-zA-Z0-9_]+$/g.test($.trim(loginName))) {
					alert("用户名只能是数字，字母和下划线！");
					return false;
				}
				var loginPasswd = $("#loginPasswd").val();
				var confirmPasswd = $("#confirmPasswd").val();
				if(loginPasswd == null || $.trim(loginPasswd) == "") {
					alert("请填写密码！");
					return false;
				}
				
				if($.trim(loginPasswd).length < 6) {
					alert("密码长度不可少于6位！");
					return false;
				}
				
				if($.trim(loginPasswd).length > 24) {
					alert("密码长度不可超过24位！");
					return false;
				}
				
				if(!/^[a-zA-Z0-9_]+$/g.test($.trim(loginPasswd))) {
					alert("密码只能是数字，字母和下划线！");
					return false;
				}
				if(confirmPasswd == null || $.trim(confirmPasswd) == "") {
					alert("请填写密码确认！");
					return false;
				}
				if($.trim(loginPasswd) != $.trim(confirmPasswd)) {
					alert("两次密码填写不一致！");
					return false;
				}
				var realName = $("#realName").val();
				if(realName == null || $.trim(realName) == "") {
					alert("请填写真实姓名！");
					return false;
				}
				var email = $("#email").val();
				if(email == null || $.trim(email) == "") {
					alert("请填写邮箱！");
					return false;
				}
				if(!/^([a-zA-Z0-9_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/g.test($.trim(email))){
					alert("邮箱格式错误！");
					return false;
				}
				var verifyCode = $("#verifyCode").val();
				if(verifyCode == null || $.trim(verifyCode) == "") {
					alert("请填写验证码！");
					return false;
				}
				return true;
			}
			function ChangeImage() {
				var checkimage = document.getElementById("checkimage");
				checkimage.src = "image.jsp?" + Math.random();
			}
		</script>
	</head>
	<body>
		<div id="header">
			<div id="top">
		       <ul>
		            <li><marquee onmouseover=this.stop() onmouseout=this.start()>今日访问：${accessCount }&nbsp;&nbsp;共享资源总数：${resCount }&nbsp;&nbsp;注册用户总数：${userCount }&nbsp;&nbsp;资源共享达人：${daUser.realName }&nbsp;&nbsp;资源下载热度：${faRes.name }</marquee></li>
		       </ul>
			</div>
			<div id="bottom">
				<div id="bleft">
					<img src="<%=basePath%>res/images/share_05.jpg" width="387"
						height="65" />
				</div>
			</div>
		</div>
		<div id="content">
			<div class="mt">
				<h3>
					用户注册
				</h3>
			</div>
			<form action="<%=basePath%>njcc/register.action" method="post"
				onsubmit="javascript:return check();" style="float: left;">
				<div class="mc1">
					<div class="fl">
						<div class="item">
							<span class="label">登录名：</span>
							<div class="ho">
								<input id="loginName" name="user.loginName" type="text"
									class="input-text" />
								<font class="red">&nbsp;(*注册后不可更改)</font>
							</div>
						</div>
						<div class="item">
							<span class="label">登录密码：</span>
							<div class="ho">
								<input id="loginPasswd" name="user.loginPasswd" type="password"
									class="input-text" />
								<font class="red">&nbsp;*</font>
							</div>
						</div>
						<div class="item">
							<span class="label">确认密码：</span>
							<div class="ho">
								<input id="confirmPasswd" name="confirmPasswd" type="password"
									class="input-text" />
								<font class="red">&nbsp;*</font>
							</div>
						</div>
						<div class="item">
							<span class="label">真实姓名：</span>
							<div class="ho">
								<input id="realName" name="user.realName" type="text"
									class="input-text" />
								<font class="red">&nbsp;(*注册后不可更改)</font>
							</div>
						</div>
						<div class="item">
							<span class="label">邮箱：</span>
							<div class="ho">
								<input id="email" name="user.email" type="text"
									class="input-text" />
								<font class="red">&nbsp;(*)</font>
							</div>
						</div>
						<div class="item">
							<span class="label">验证码：</span>
							<div class="ho">
								<ul>
									<li style="float: left;">
										<input id="verifyCode" name="verifyCode" type="text"
											class="input-text1" />
										&nbsp;&nbsp;&nbsp;&nbsp;
									</li>
									<li style="">
										<img alt="看不清楚？点击更换验证码" style="cursor : pointer;" id="checkimage" onclick="javascript:ChangeImage();" src="image.jsp" />
									</li>
								</ul>
							</div>
						</div>

						<div class="item" style="padding-top: 10px;">
							<span class="label" style="width: 130px;">&nbsp;</span>
							<div class="ho">
								<input name="register" type="submit" value=""
									style="background: url(<%=basePath%>res/images/dv11.png) no-repeat; width: 150px; height: 40px;"
									class="input1" />
							</div>
						</div>
						<div class="item">
							<span class="label">&nbsp;</span>
							<div class="ho">
								<input type="checkbox" name="checkbox" id="checkbox"
									checked="checked" />
								<label>
									<a
										href="javascript:window.location.href='<%=basePath%>protocol.html'";>同意以下协议并注册</a>
								</label>
							</div>
						</div>
					</div>
			</form>
			<div class="fr">
				<div class="h4">
					资源共享平台的会员?
				</div>
				<div class="desc">
					现在就登录资源共享平台享受专业
					<br />
					丰富知识。
					<br />
					<br />
					<a href="<%=basePath%>login.jsp"><img
							src="<%=basePath%>res/images/dv.png">
					</a>
				</div>
			</div>
		</div>
		<div id="banquan">
			<ul>
				<li>
					南京化工职业技术学院--资源共享网
					<img src="<%=basePath%>res/images/pic.gif" width="50" height="12" />
				</li>
				<li>
					诚聘英才 | 友情链接 | 联系我们
				</li>
				<li>
					版权所有©南京化工职业技术学院 ICP：沪B2-20030192
				</li>
			</ul>
		</div>
	</body>
</html>
